<?php

chdir('../');

require('includes/setUp.php');

if (isset($_GET["lang"]) ) {
  try {
    
    Validations::validateString($_GET["lang"], null, Validations::regexp_language);
    $_SESSION["language"] = $_GET["lang"];

    if ($LOGGED) {
      $user->Language = $db->find('Language', $_GET["lang"]);
      $db->flush();
    }
    
  } catch (Exception $ex) {
      globalFunc::redirect(WebRoot.'index.php?errMsg='.rawurlencode($ex->getMessage()));
    }
}

globalFunc::redirect();

?>
